package com.showtao.front.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.showtao.front.domain.Order;

public interface OrderRepository extends JpaRepository<Order, String> {

    Page<Order> findByReceiverPhone(String receiverPhone, Pageable pageable);
    
    @Query("select o from Order o where o.receiverPhone = ?1 and o.orderDate >= ?2 and o.orderDate <= ?3")
    List<Order> findByReceiverPhoneAndOrderDate(String receiverPhone, Date startDate, Date endDate);
}
